<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试IFRAME</title>
<script type="text/javascript">
function load(){
        var doc;
        if (document.all){//IE
                doc = document.frames["ifr_id"].document;
        }else{//Firefox    
                doc = document.getElementById("ifr_id").contentDocument;
        }

        //doc.getElementById("main").style.color="red";
        //火狐获得内容
        var txt = doc.getElementById("main").textContent;
         //IE获得内容
         //var txt = doc.getElementById("main").innerText;
        alert(txt);
}
</script>
</head>
<body>
<button onclick="load()">点击获得内容</button>
<iframe id="ifr_id" name="ifr_id" src="http://www.javaeye.com" width ="100%" height="300"></iframe>

</body>
</html>